package fristphase.day9_14;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class For循环增强型 {
    public static void main(String[] args) {

        Collection  c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        c.add("six");
        Iterator it = c.iterator();//创建迭代器，准备遍历数组
        while (it.hasNext()){
            String str = (String) it.next();
            System.out.println(str);
        }
        for(Object obj : c){
            String str = (String) obj;
            System.out.println(str);
        }
    }
}
